package com.nhxcz.bigdataweb.controller;

import com.nhxcz.bigdataweb.entity.Move;
import com.nhxcz.bigdataweb.service.serviceImpl.MoveService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;

@Controller
@RequestMapping("/move")
public class MoveController {

    @Autowired
    public MoveService moveService;

    @ResponseBody
    @RequestMapping("/analysis")
    public ArrayList<Move> move_analysis(){
        ArrayList<Move> analysis = moveService.move_analysis();
        return analysis;
    }

    @ResponseBody
    @RequestMapping(value="/fresh")
    public ArrayList<Move> move(){
        ArrayList<Move> fresh = moveService.fresh();
        for(Move i:fresh) {
            System.out.println(i.getTime()+" "+i.getCount()+" "+i.getType());
        }
        return fresh;
    }

    @RequestMapping("/delete")
    public void delete(){
        moveService.delete();

    }
}
